import React from 'react';
export class MyClassInput extends React.Component{
	 componentDidMount () {
	    console.log('HelloWorld 第一次挂载到界面上');
	  }
	  componentWillUnmount () {
	    console.log('HelloWorld 即将移除（销毁）');
	  }
	constructor(props){
		console.log(props,'props')
			super()
			//初始化state
			this.state={
				count:0
			}
			//this.handleOninput=this.handleOninput.bind(this)
		}
		//简化写法
		// state={
		// 		count:0
		// 	}
	handleOninput=(e)=>{
		console.log(e.target.value,'sda')
		this.setState({
			count:e.target.value
		})
	}
	render(){
		return (<div>
		<ul>
			{this.props.list.map((item,index)=>{
				return (<li key={index}>{item.name}</li>)
			})}
		</ul>
		<input onInput={this.handleOninput} type='password'/> <div>count:{this.state.count}</div></div>)
	}
}